"""
This`s a learning demo
"""
# string = "   Python learning   "
# print(string)
# print(string.upper())
# print(string.lower())
# print(string.title())
# print(string.rstrip())
# print(string.find("thon"))
# print(string.replace(" ", "X"))
# print(string.rstrip())
# print("thon" in string)
# print("not" not in string)

# print(10 / 3)
# print(10 // 3)
# print(10 % 3)
# print(10 ^ 3)
# print(10**3)

# x = input("Please entry X: ")
# y = int(x) + 99
# print(f"{x} + 99 = {y}")

# temperatur = int(input("Please entry the value >>"))

# if temperatur > 30:
#     print("Too Hot!")
# elif temperatur > 20 and temperatur <= 30:
#     print("A little bit hot")
# elif temperatur > 10 and temperatur <= 20:
#     print("That`s comfortable")
# else:
#     print("Too cold")
# print("Done")

# age = 13
# message = "OK" if age >= 18 else "NOT OK"
# print(message)

# for i in range(1, 11, 3):
#     print(f"Now is`s {i} loop & sending" + i*'.')
# print("Done")

# message = True
# for i in range(1, 4):
#     print(f"it`s {i} loop and sending" + '.'*i)
#     if message:
#         print("Sending seccess!")
#         break
# else:
#     print("Sending Fail!")

# for x in "Hello World":
#     print(x)
#     print(ord(x))

# command = ""
# while command.upper() != "QUITE":
#     command = input(">>>")
#     print(command)

# 练习--输出1~10中的偶数并告知偶数的个数
# count = 0
# for number in range(1, 10):
#     if number % 2 == 0:
#         count += 1
#         print(number)
# print(f"We have {count} numbers")


# def multiply(*numbers):
#     result = 1
#     for number in numbers:
#         result *= number
#     return result


# print(multiply(1, 2, 3, 4, 5, 6, 2))

# def save_user(**user):
#     print(user)
#     print(user["money"])


# save_user(id="001", name="John", age=48)
# save_user(id="002", name="King", age=18)
# save_user(id="001", name="John", money=9999999)

# fzz_bzz问题
# 被3整除 -- fzz
# 被5整除 -- bzz
# 同时整除 -- fzzbzz
# 不能整除 -- 本身

# def fizz_buzz(number):
#     result = number
#     flag = 0
#     # fizz_buzz
#     if number % 3 == 0 and number % 5 == 0:
#         result = "fizz_buzz"
#     # fizz
#     elif number % 3 == 0:
#         result = "fizz"
#         flag += 1
#     # buzz
#     elif number % 5 == 0:
#         result = "buzz"
#         flag += 1
#     return result


# while True:
#     message = input(">>>")
#     if message.lower() == "quite":
#         break
#     print(fizz_buzz(int(message)))

# user = ["hurry", "pal", "alice"]
# for index, value in enumerate(user):
#     print(index, value)

# first, *other = user
# print(first, other)

# numbers = [1, 2, 3, 4, 5]

# # add
# numbers.append("--")
# numbers.insert(0, "--")
# print(numbers)

# # remove
# numbers.pop()
# numbers.remove("--")
# del numbers[0:3]
# print(numbers)

# # clear
# numbers.clear()
# print(numbers)

# for index, value in enumerate(numbers):
#     print(index, value)

# goods = [
#     ("product1", 10),
#     ("product2", 9),
#     ("product3", 11)
# ]

# # price = list(map(lambda list: list[1], goods))
# # list comperhension => [express for item in items]
# # express 为要做的操作，item为item中的元素，items为实际要处理的某个迭代器 最后的[]则是将分别得到的元素组成一个list并返回
# price = [x[1] for x in goods]
# price.sort()
# print(price)

# # filted = list(filter(lambda x: x[1] > 10, goods))
# filtered = [x for x in goods if x[1] > 10]
# print(filtered)

# letters = ('A', 'B', 'C')
# a, b, c = letters
# print("abc ->", a, b, c)
# print("letters ->", letters)

# a, b, c = 2, 4, 8
# print("Before swap abc ->", a, b, c)
# a, b = b, a
# print("after swap abc ->", a, b, c)

# contects = {"hurry": 123, "judy": 234, "bob": 345, "molly": 456}

# new = {number: 111 for number in contects}
# print(new)

# exercise
# _sentence = "this`s a demo for function test"


# def get_freq_letter(sentence):
#     char_frequence = {}

#     for char in sentence:
#         if char in char_frequence:
#             char_frequence[char] += 1
#         else:
#             char_frequence[char] = 1

#     char_frequence_sorted = sorted(
#         char_frequence.items(),
#         key=lambda kv: kv[1],
#         reverse=True)

#     return char_frequence_sorted[0]


# print(get_freq_letter(_sentence))
# # I think`s interseting by using vscode-neovim editor

# try:
#     while True:
#         value = int(input("test_value >>>"))
#         print(value)
#         if value == 0:
#             break
# except ValueError as err:
#     print(err)
#     print(type(err))
# print("\n")

# class Person:
#     def __init__(self, name="unknow", age=0, address="unkonw"):
#         self.name = name
#         self.age = age
#         self.address = address

#     def __str__(self):
#         return f"{self.name}, {self.age}, {self.address}"

#     @classmethod
#     def defalt(cls):
#         return cls("XXX", 666, "XXX")

#     def show_detail(self):
#         pass


# peter = Person.defalt()
# print(peter)

# class product:
#     def __init__(self, price):
#         self.__price = price

#     # 通过@property和@price.setter将原本需要显式调用的getter方法与setter方法进行了封装，使得类的某一成员变量可以更简单的调用setter和getter方法。

#     @property
#     def price(self):
#         return self.__price

#     @price.setter
#     def price(self, value):
#         if value < 0:
#             print("Price cannot be negative!")
#             print("Price set FAIL!")
#             return
#         self.__price = value


# apple = product(10)
# print(apple.price)
# apple.price = -10
# print(apple.price)
# apple.price = 100
# print(apple.price)

# class Animal:
#     def __init__(self):
#         self.age = 0
#         self.size = "unknown"


# class Bird(Animal):
#     def __init__(self):
#         # 此处类比于C++在走初始化列表时，子类显式调用父类的构造函数以初始化父类的类成员变量
#         super().__init__()
#         self.size = "small"


# bird = Bird()
# print(bird.age)
# print(bird.size)

import pathlib
print(pathlib.Path)
